<?php

namespace app\api\controller;

use app\api\controller\mytool\Sendmessage;
use app\common\model\Sync\SyncCenter;

class Notify
{
	public function notify()
	{
		$data = file_get_contents('php://input');
		$data = json_array('{"SyncId":"1","Status":"4","SynImg":"https://baidu.png","SyncTime":"2020-01-01 23:00:00"}', true);
		$sync = SyncCenter::where('Id', $data['SyncId'])->findOrEmpty();
		if ($sync->isEmpty()) {
			return false;
		}
		$sync->save(['Status' => $data['Status'], 'SycImg' => $data['SynImg'], 'SyncTime' => $data['SyncTime']]);
		if ($data['Status'] == 4) {
			Sendmessage::reviewSync(3, $sync);
		}
		return true;
	}
}
